home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.9 KB | 187 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWOvlShp.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWOVLSHP_H
- #include "FWOvlShp.h"
- #endif
-
- #ifndef FWGRGLOB_H
- #include "FWGrGlob.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- #ifndef FWGRUTIL_H
- #include "FWGrUtil.h"
- #endif
-
- #ifndef FWFXMATH_H
- #include "FWFxMath.h"
- #endif
-
- #ifndef FWRASTER_H
- #include "FWRaster.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphics_OvalShape
- #endif
-
- FW_DEFINE_CLASS_M1(FW_COvalShape, FW_CBoundedShape)
-
- FW_REGISTER_ARCHIVABLE_CLASS(FW_LOvalShape, FW_COvalShape, FW_COvalShape::Read, FW_CShape::Write)
-
- //========================================================================================
- // class FW_COvalShape
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::FW_COvalShape(const FW_COvalShape& other) :
- FW_CBoundedShape(other)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::FW_COvalShape(const FW_CRect& rect,
- FW_ERenderVerbs renderVerb,
- const FW_PInk& ink,
- const FW_PStyle& style) :
- FW_CBoundedShape(rect, renderVerb, ink, style, FW_kNormalFont)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::FW_COvalShape(FW_CReadableStream& archive) :
- FW_CBoundedShape(archive)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::~FW_COvalShape
- //----------------------------------------------------------------------------------------
-
- FW_COvalShape::~FW_COvalShape()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::Render
- //----------------------------------------------------------------------------------------
-
- void FW_COvalShape::Render(FW_CGraphicContext& gc) const
- {
- gc.GetRasterizer()->RenderOval(gc,
- fRect,
- GetRenderVerb(),
- fInk,
- fStyle);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::RenderOval
- //----------------------------------------------------------------------------------------
-
- void FW_COvalShape::RenderOval(FW_CGraphicContext& gc,
- const FW_CRect& rect,
- FW_ERenderVerbs renderVerb,
- const FW_PInk& ink,
- const FW_PStyle& style)
- {
- gc.GetRasterizer()->RenderOval(gc,
- rect,
- renderVerb,
- ink,
- style);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::HitTest
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_COvalShape::HitTest(FW_CGraphicContext& gc,
- const FW_CPoint& test,
- FW_CFixed tolerance) const
- {
- if(fRenderVerb == FW_kNoRendering)
- return FALSE;
-
- FW_CRect ovalRect(fRect);
- ovalRect.Inset(-tolerance, -tolerance);
-
- if (!::FW_PtInOval(ovalRect, test))
- return FALSE;
-
- if (fRenderVerb == FW_kFrame)
- {
- ovalRect = fRect;
- FW_CFixed inset = tolerance + GetPenSize();
- ovalRect.Inset(inset, inset);
- return ! ::FW_PtInOval(ovalRect, test);
- }
-
- return TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CShape* FW_COvalShape::Copy() const
- {
- return FW_NEW(FW_COvalShape, (*this));
- }
-
- //----------------------------------------------------------------------------------------
- // FW_COvalShape::Read
- //----------------------------------------------------------------------------------------
-
- void* FW_COvalShape::Read(FW_CReadableStream& archive)
- {
- return FW_NEW(FW_COvalShape, (archive));
- }
-
-
-